package model

import "time"

type Order struct {
	Id         uint      `gorm:"column:id;type:int(20);comment:下单id;primaryKey;not null;" json:"id"`               // 下单id
	ShopId     uint      `gorm:"column:shop_id;type:int(20);comment:商品关联id;not null;" json:"shop_id"`              // 商品关联id
	UserId     uint      `gorm:"column:user_id;type:int(20);comment:用户关联id;not null;" json:"user_id"`              // 用户关联id
	Address    string    `gorm:"column:address;type:varchar(255);comment:地址;not null;" json:"address"`             // 地址
	TotalPrice float64   `gorm:"column:total_price;type:decimal(10, 2);comment:商品总价;not null;" json:"total_price"` // 商品总价
	CreatedAt  time.Time `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt  time.Time `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt  time.Time `gorm:"column:deleted_at;type:datetime;default:NULL;" json:"deleted_at"`
}

func (o *Order) TableName() string {
	return "order"
}
